package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmLoginDto;
import com.heima.model.wemedia.dtos.WmPageReqDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmNewsService;
import com.heima.wemedia.service.WmSensitiveService;
import com.heima.wemedia.service.WmUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {

    @Autowired
    private WmSensitiveService wmSensitiveService;

    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/list")
    public ResponseResult login(@RequestBody WmPageReqDto dto){
            log.info("敏感词列表查询:{}",dto);
        return wmSensitiveService.findSensitiveList(dto);
    }

    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        log.info("保存敏感词;{}", wmSensitive);
        return wmSensitiveService.saveSensitive(wmSensitive);
    }

    @PostMapping("/update")
    public ResponseResult upSensitive(@RequestBody WmSensitive wmSensitive) {
        log.info("修改敏感词;{}", wmSensitive);
        return wmSensitiveService.upSensitive(wmSensitive);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult delSensitive(@PathVariable("id") Integer id) {
        log.info("删除敏感词: {}", id);
        return wmSensitiveService.delSensitive(id);
    }

}
